/*
 * @Description: ...
 * @Author: yangli 121029539@qq.com
 * @Date: 2025-02-10 10:15:43
 * @LastEditTime: 2025-02-13 15:08:35
 * @LastEditors: yangli 121029539@qq.com
 * @FilePath: \uniapp\src\api\order.ts
 */
import request from '@/utils/request'

// 上传图片  {image}
// https://school.iwycgj.com/api/upload/image
export function uploadImage(file: any, token?: string) {
    return request.uploadFile({
        url: '/upload/image',
        filePath: file,
        name: 'file',
        header: {
            token
        },
        fileType: 'image'
    })
}
/**
 *  uni.chooseImage({
            count: 1,
            sizeType: ['original', 'compressed'],
            // sourceType: ['camera', 'album'], //这要注意，camera掉拍照，album是打开手机相册
            sourceType: ['camera'], //这要注意，camera拍照，album是打开手机相册
            success: (res) => {
                const tempFilePaths = res.tempFilePaths
                onUploadPic(tempFilePaths)
            },
            fail(err) {
                console.error('选择图片失败:', err)
            }
        })

 const onUploadPic = async (tempFilePaths: string[]) => {
    const data = await uploadImage(tempFilePaths[0], token.value)
    sign_pic.value = data.uri
    handleSubmit()
}
 */

